#include <iostream>
#include <vector>

#include "numbered.h"
#include "Employee.h"

using namespace std;

struct X {
    X() { cout << "X()" << endl; }
    X(const X&) { cout << "X(const X&)" << endl; }
    X& operator =(const X&);
    ~X() { cout << "~X()" << endl; }
};

X& X::operator =(const X& rhs)
{
    cout << "X& operator=(const X&)" << endl;
    return *this;
}

void f1(X x) { }
void f2(X &x) { }

void pr_13_13()
{
    cout << "Local variable: " << endl;
    X x;
    cout << endl;

    cout << "Pass By Value: " << endl;
    f1(x);
    cout << endl;

    cout << "Pass By Reference: " << endl;
    f2(x);
    cout << endl;

    cout << "Dynamic allocation: " << endl;
    X *px = new X;
    cout << endl;

    cout << "Add to container: " << endl;
    vector<X> vx;
    vx.push_back(x);
    cout << endl;

    cout << "Free dynamic allocation: " << endl;
    delete px;
    cout << endl;

    cout << "Indirect initialization and assignment: " << endl;
    X y = x;
    y = x;
    cout << endl;

    cout << "Program End." << endl;
}

void pr_13_14()
{
    numbered a, b = a, c = b;
    f(a);
    f(b);
    f(c);
}

void pr_13_18()
{
    Employee a("Zhao"), b = a, c = b;
    f_employee(a);
    f_employee(b);
    f_employee(c);
}

int main()
{
    pr_13_18();
    return 0;
}
